#include<bits/stdc++.h>
using namespace std;
const int p=998244353;
int main(){
  ios::sync_with_stdio(false);
  for(int n=1;n<=1024;n<<=1){
    string s; bool D=true; int r=0;
    for(int i=0;i<n;i++)
      s+=__builtin_parity(i)?'A':'B';
    cout<<s<<endl;
    set<string> T; T.emplace(s);
    queue<string> q; q.emplace(s);
    while(!q.empty()){
      auto u=q.front(); r++,q.pop();
      for(int i=1;i<u.length();i++)
        if(u[i-1]=='B'||u[i]=='A'){
          string v;
          for(int j=0;j<u.length();j++)
            if(j!=i-1&&j!=i)v+=u[j];
          if(T.find(v)==T.end())
            T.emplace(v),q.emplace(v);
        }
    }
    cout<<n<<' '<<r<<endl;
  }
  return 0;
}